//记分牌类
class ScorePanel{
    score=0;
    level=1;
    scoreSpan:HTMLElement;
    levelSpan:HTMLElement;
    //设置变量限制等级
    maxLevel : number;
    //设置变量表示多少分升级
    upScore :number;
    constructor(maxLevel : number = 10,upScore : number = 10){
        this.scoreSpan = document.getElementById('score')!;
        this.levelSpan = document.getElementById('level')!;
        this.maxLevel = maxLevel;
        this.upScore = upScore
    }
    //加分方法
    addSore(){
        this.scoreSpan.innerHTML = ++this.score +'';
        //分数判断
        if(this.score % this.upScore ===0){
            this.levelUp();
        }
    }
    //等级提升
    levelUp(){
        if (this.level<=this.maxLevel) {
            this.levelSpan.innerHTML = ++this.level +'';
        }  
    }
}

export default ScorePanel;